function MosNeu = MosMom2MosNeu(MosMom)
% MosMom2MosNeu - Mos matrix Mom notation -> Mos matrix CATS Neu notation
%
%   MosNeu = MosMom2MosNeu(MosMom)
%
% This function transfoms the offset matrix MosMom, with dates (first column)
% in MJD form and code (second column) in Mom env notation
%           East   North Vertical  Code
%             1      1      1       7   
%             1      1      0       6
%             1      0      1       5
%             1      0      0       4
%             0      1      1       3
%             0      1      0       2
%             0      0      1       1
%
% to MosNeu, with dates (first column) in fractional form and code (second
% column) in CATS Neu notation
%           North  East  Vertical  Code
%             1      1      1       7   
%             1      1      0       6
%             1      0      1       5
%             1      0      0       4
%             0      1      1       3
%             0      1      0       2
%             0      0      1       1
%
% Example: the matrix
%       Minit = [53372 7; 55001 4] 
% is changed into
%       Mfin  = [2005.00274 7; 2009.46301 2].
%
% See also InspOffsetMom, OffsetsfromCell.

% G. Teza, 2022.

if isempty(MosMom)
    MosNeu = [];
    return
end

MosNeu = MosMom;
I5Mom = MosMom(:,2) == 5;
if ~isempty(I5Mom)
    MosNeu(I5Mom,2) = 3;
end
I4Mom = MosMom(:,2) == 4;
if ~isempty(I4Mom)
    MosNeu(I4Mom,2) = 2;
end
I3Mom = MosMom(:,2) == 3;
if ~isempty(I3Mom)
    MosNeu(I3Mom,2) = 5;
end
I2Mom = MosMom(:,2) == 2;
if ~isempty(I2Mom)
    MosNeu(I2Mom,2) = 4;
end

tMJD = MosMom(:,1);
tfrac = MJD2frac(tMJD);
MosNeu(:,1) = tfrac;